<template>
    <div>
<h1>登陆页面</h1>
<table class="table">
    <tbody>
        <tr>
            <td>账号</td>
            <td>
                <input type="text" v-model="data.Account">
            </td>
        </tr>
        <tr>
            <td>密码</td>
            <td>
                <input type="password" v-model="data.pwd">
            </td>
        </tr>
        <tr>
            <td></td>
            <td>
                <input type="button" value="登录" class="btn btn-success" @click="Login">
            </td>
        </tr>
    </tbody>
</table>
    </div>
</template>

<script setup lang="ts">
import axios from 'axios';
import { ref } from 'vue';
import { useRouter } from 'vue-router';
const router=useRouter();

const data=ref({
    Account:"",
    pwd:"",
})

const Login=()=>{
    axios.get("/api/Log/GetLog",{params:data.value}).then(res=>{
        if(res.data==-1)
    {
        alert("账号不存在");
    }
    else if(res.data==-2)
    {
        alert("密码错误");
    }
    else if(res.data==1)
    {
alert("登陆成功")
router.push({path:"/"})
    }
    })
}
</script>

<style scoped>

</style>